
export default class LoginForm {
    constructor(element, options) {
        this.$element = $(element);
        this.validateForm = null;
        this.init();
    }

    init() {
        this.validateForm = this.getValidateForm();
    }

    getValidateForm() {
        const $element = this.$element;
        return this.$element.validate({
            submitHandler: function (valid) {
                if (valid) {
                    $element.submit()
                }
                return false
            },
            rules: {
                name: {
                    required: true
                },
                password: {
                    required: true
                }
            },
            messages: {
                name: {
                    required: '请输入用户名/密码/邮箱'
                },
                password: {
                    required: '请输入密码'
                }
            }
        })
    }
}




